home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-01-07 | 5.2 KB | 337 lines | [TEXT/KEEN] |
- About templates and this file format
- ------------------------------------
- If you didn't read the manual, you'll want to know how to use this:
- type the name of an entry, then hit <command><return> to replace
- the name with its template. To advance to the next logical insertion
- point, keep hitting <command><return>. Case counts in the template name.
-
- hAWK templates are a special case (see the first entries below): if your
- entry name expands to something that starts with "hAWK", EnterAct will
- select all of it instead of advancing the insertion point. And if you
- press <command><return> with a hAWK template selected, EnterAct will
- run the hAWK program. You can also press <enter> to run a selected program,
- but note that pressing <enter> does not expand a code template, only
- <command><return> does that.
-
- If you change and save this file with EnterAct, changes take effect
- immediately (no need to restart EnterAct). Keep this file in the same
- folder where you have EnterAct, at the same level, and don't change its name.
-
- Please change this file to suit your needs--just follow the rules below.
- Feel free to add or delete entries, or change entry names or contents.
-
- Keep each entry in an ENTRY/END sandwich. Following ENTRY, on a new line
- put the name of the template--note it can contain any non-blank characters.
- Put the template (or definition if you like) for the name on a new line
- immediately below the name line. Each template ends with "END" on a new
- line. Arbitrary text like this is OK between entries (just don't start any
- comment line, or for that matter any line inside a template,
- with "ENTRY" or "END"). The last <return> in the definition is not included,
- so put a blank line after your definition body if you want your definition
- to include a final <return>, as in the "echo" template just below.
-
- If you put the special symbol '@' in your template, then insertion
- point advances (automatic when you put in a template, command-return
- thereafter) will stop at the '@' and select it. Non-code insertion points
- should be specially marked with '@', but you mostly don't have to specially
- mark obvious places in a C or C++ code template.
-
- Keep all your entries flush-left, and EnterAct will adjust your indentation
- when pasting your template in. Just open up a new line and tab in to the
- right position before typing the entry name and pressing <command><return>.
-
- Tip: if you change your templates a lot, add this file to your "Locations" menu.
-
- There are six builtin variables that have special meanings inside templates:
- @@clip, @@date (includes year), @@time, @@year, @@me, and @@mail.
- The first one, @@clip, stands for all the text from your last Cut or Copy, ie
- the contents of your current clipboard. Note that builtin variable names do
- not have to be followed by any white space, as in the "c" example which
- contains the line "@@clip*/" just below. "@@clipthis" would also work.
-
- If you have used Internet Config to set your real name and email address,
- then @@me will become your name and @@mail your email address. For an
- example, see the "top" and "mail" templates down below.
-
- Some examples using the builtin template variables:
- ENTRY
- t
- @@time
- END
- ENTRY
- d
- @@date
- END
- ENTRY
- y
- @@year
- END
-
- ( "c" for comment out, and "0" (a zero) for #if 0 out. These are designed to
- work best on whole lines. Select one or more entire lines, Cut, type
- "c" or "0", then hit <command><return> )
- ENTRY
- c
- /*
- @@clip*/
-
- END
- ENTRY
- 0
- #if 0
- @@clip#endif
-
- END
-
- (Put the name of the enum, eg ParseStates, on the clip first)
- ENTRY
- enum
- enum @@clip
- {
- e@@clip_@,
- e@@clip_@
- };
-
- END
-
- Some hAWK templates:
- ENTRY
- echo
- hAWK -f$EchoFullPathNames -- MFS
-
- END
- ENTRY
- compare
- hAWK -f$CompareFiles -- MFS
-
- END
- ENTRY
- boiler
- hAWK -f$BoilerPlate -vputInComment=1 -vfile="@.c"
- -vauthor="KE" -vcompany="bdibdi" -ss
-
- END
-
- ENTRY
- time
- hAWK -f$Time
-
- END
-
- ENTRY
- ff
- hAWK -f$FormatFunctionIntro
-
- END
-
- Some standard templates:
-
- ENTRY
- for
- for (; ; )
- {
-
- }
-
- END
- ENTRY
- fori
- for (i = 0; i < @; ++i)
- {
-
- }
-
- END
- ENTRY
- while
- while ()
- {
-
- }
-
- END
- ENTRY
- switch
- switch ()
- {
- case :
-
- break;
- default:
- break;
- }
-
- END
- ENTRY
- switch'
- switch ()
- {
- case '':
-
- break;
- default:
- break;
- }
-
- END
- ENTRY
- if
- if ()
- {
-
- }
-
- END
- ENTRY
- else
- else
- {
-
- }
-
- END
- ENTRY
- ife
- if ()
- {
-
- }
- else
- {
-
- }
-
- END
- ENTRY
- iff
- if ()
- {
-
- }
- else if ()
- {
-
- }
-
- END
- ENTRY
- elif
- else if ()
- {
-
- }
-
- END
- ENTRY
- do
- do
- {
-
- } while ();
-
- END
- ENTRY
- struct
- typedef struct @
- {
- ; //
- } @, *@Ptr;
-
- END
-
- If you type something a lot--make a template for it!
- Error checking, maybe...
- ENTRY
- e
- if (theErr == noErr)
- {
-
- }
-
- END
- ...or looping a lot
- ENTRY
- while--
- while (--@ >= 0)
- {
-
- }
-
- END
-
- A quick&dirty file top
- --change the names below to your own, Save, and try it out by typing
- "top<command><return>" in a separate window.
- ENTRY
- top
- /****
- File.....: @
- Date.....: @@date
- .........: © @@year Dynabyte (@@me). All rights reserved.
- Spec.....: @
- ****/
-
- END
- ENTRY
- mail
- @@mail (@@me)
- END
- ENTRY
- i
- #include "@.h"
-
- END
-
- Make a quick comment by typing just a forward slash, then cmd-return:
- ENTRY
- /
- /* @
- */
- END
-
- Start up a function definition
- ENTRY
- func
- /* @
- */
- OSErr @
- (, //
- //
- )
- {
-
-
-
- }
-
- END
-
- Dereference a Handle
- ENTRY
- d
- (**@).@
- END
-
- An HTML template
- ENTRY
- html
- <HTML>
-
- <HEAD>
- <TITLE>@</TITLE>
- </HEAD>
-
- <BODY>
-
- <H1>@</H1>
-
- <P>@</P>
-
- </BODY>
-
- </HTML>
-
- END
-
- OK, your turn...a template for a class, perhaps?
-